<? $this->headLink()->appendStylesheet('/css/admin/order_details.css') ?>
<h1><?= $this->translate('Details of order #'); ?><?= $this->order->id ?></h1>

<div class="side-block">
    <h2>
        <?= $this->translate('Order'); ?>
    </h2>
    <table>
        <tr>
            <td>
                <?= $this->translate("Number"); ?>
            </td>
            <td>
                <?= $this->order->id ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Total"); ?>
            </td>
            <td>
                <?= $this->order->total ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Created"); ?>
            </td>
            <td>
                <?= $this->order->created ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Updated"); ?>
            </td>
            <td>
                <?= $this->order->updated ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Status"); ?>
            </td>
            <td>
                <?= $this->translate($this->order->order_status_name) ?>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <a href="/<?= $this->language ?>/admin/order/edit/<?= $this->order->id ?>"><?= $this->translate('Edit'); ?></a>
            </td>
        </tr>
    </table>
</div>
<div class="side-block">
    <h2>
        <?= $this->translate('Customer'); ?>
    </h2>

    <table>
        <tr>
            <td>
                <?= $this->translate("Full name"); ?>
            </td>
            <td>
                <?= $this->escape($this->customer->full_name) ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Phone"); ?>
            </td>
            <td>
                <?= $this->escape($this->customer->phone) ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Email"); ?>
            </td>
            <td>
                <?= $this->escape($this->customer->email) ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("City"); ?>
            </td>
            <td>
                <?= $this->escape($this->customer->city) ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Address"); ?>
            </td>
            <td>
                <?= $this->escape($this->customer->address) ?>
            </td>
        </tr>
        <tr>
            <td>
                <?= $this->translate("Created"); ?>
            </td>
            <td>
                <?= $this->customer->created ?>
            </td>
        </tr>

        <tr>
            <td>
                <?= $this->translate("Total"); ?>
            </td>
            <td>
                <?= $this->customer->total ?>
            </td>
        </tr>
    </table>
</div>
<div class="side-block">
    <h2>
        <?= $this->translate('Invoice'); ?>
    </h2>
    <?= $this->Errors($this->errors) ?>
    <?= $this->formInvoice ?>
</div>
<div class="side-block">
    <h2>
        <?= $this->translate('Shipment'); ?>
    </h2>
    <? if ($this->shipment): ?>
        <table>
            <tr>
                <td>
                    <?= $this->translate("Quantity"); ?>
                </td>
                <td>
                    <?= $this->shipment->quantity ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?= $this->translate("Paid"); ?>
                </td>
                <td>
                    <?= $this->shipment->cost ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?= $this->translate("To name"); ?>
                </td>
                <td>
                    <?= $this->escape($this->shipment->to_name) ?>
                </td>
            </tr>

            <tr>
                <td>
                    <?= $this->translate("Created"); ?>
                </td>
                <td>
                    <?= $this->shipment->created ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?= $this->translate("Updated"); ?>
                </td>
                <td>
                    <?= $this->shipment->updated ?>
                </td>
            </tr>
            <tr>
                <td>
                    <?= $this->translate("Status"); ?>
                </td>
                <td>
                    <?= $this->translate($this->shipment->shipment_status_name) ?>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <a href="/<?= $this->language?>/admin/shipment/edit/<?=$this->order->id?>"><?= $this->translate('Edit'); ?></a>
                </td>
            </tr>
        </table>
    <? endif ?>
</div>
<div class="bottom-block">
    <h2>
        <?= $this->translate('Order products'); ?>
    </h2>
    <table>
        <tr>
            <th><?= $this->translate("Product") ?></th>
            <th><?= $this->translate("Category") ?></th>
            <th><?= $this->translate("Price") ?></th>
            <th><?= $this->translate("Count") ?></th>
        </tr>
        <? foreach ($this->products as $product): ?>
            <tr>
                <td>
                    <a href="/<?= $this->language ?>/product/<?= $product->id ?>">
                        <?= $this->escape($product->manufacturer_name) ?>
                        <?= $this->escape($product->name) ?>
                        (<?= $this->escape($product->mpn) ?>)
                    </a>
                </td>
                <td>
                    <a href="/<?= $this->language ?>/catalog/<?= $product->category_id ?>">
                        <?= $this->escape($product->category_name) ?>
                    </a>
                </td>
                <td>
                    <span><?= $product->price ?>&nbsp;<?= $this->translate('grn') ?></span>
                </td>
                <td>
                    <?= $product->count ?>
                </td>
            </tr>
        <? endforeach; ?>
        <tr>
            <td/>
            <td>
                <?= $this->translate("Total") ?>
            </td>
            <td>
                <span><?= $this->total ?>&nbsp;<?= $this->translate('grn') ?></span>
            </td>
            <td>
                <?= $this->totalCount ?>
            </td>
        </tr>
    </table>

</div>